<template>
  <ul class="nav">
    <li v-for="(item,index) in list" :key="item.id" :class="flag == index? 'active' :''" @click="changeTab(index)">
      {{ item.name }}
    </li>
  </ul>
</template>

<script>
export default {
  props: {
    list: Array,
  },
  data() {
    return {
      flag:0
    };
  },
  mounted() {
 
  },
  methods: {
    changeTab(i){
      this.flag = i
      this.$emit('changeTab',i)
    }
  },
  components: {},
};
</script>

<style lang='scss' scoped>
.nav {
  width: 100%;
  overflow: scroll;
  display: flex;
  justify-content: space-between;
  flex-wrap: nowrap;
  align-items: center;
  background-color: #fff;
  // padding:0 10px;
  li {
    width: 100px;
    height: 45px;
    line-height: 45px;
    text-align: center;
    flex-shrink: 0;
  font-size: 18px;
  }
  .active {
    border-bottom: 2px solid #d00;
  }
}
ul::-webkit-scrollbar {
  display: none;
}

</style>
